package com.acegear.horizon.controllers;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.acegear.horizon.controllers.vo.ResultVO;
import com.acegear.horizon.domain.repository.jpa.OperateRespository;
import com.acegear.horizon.domain.services.OperateService;

/**
 * 
 * @author TreeJohn 17-05-15
 *
 */
@RestController
@RequestMapping("operate")
@Transactional
public class OperateConteroller {

	@Autowired
	private OperateRespository operateRespository;

	@Autowired
	private OperateService operateService;

	/**
	 * 分页查询操作记录列表列表
	 */
	@RequestMapping(value = "/getOperateLogs", method = RequestMethod.GET)
	public ResultVO<?> getOperateLogs(Long clubId, Integer page, Integer count, Long startDate, Long endDate) {
		Pageable pageable = new PageRequest(page, count);
		return new ResultVO<>(
				operateRespository.findOperateListByClubIdAndOperatetimeBetween(clubId, startDate, endDate, pageable));
	}

	/**
	 * 撤回操作
	 */
	@RequestMapping(value = "/rollback", method = RequestMethod.GET)
	public ResultVO<?> rollback(Long operateId) {
		
		return ResultVO.OPTION_SUCCESS;
	}
}
